//
//  UINavigationController+Category.m
//  VICategory
//
//  Created by MN on 2022/7/22.
//

#import "UINavigationController+Category.h"

@implementation UINavigationController (Category)
#pragma mark - # Push Pop
- (NSArray *)popToViewControllerWithClassName:(NSString*)className animated:(BOOL)animated{
    return [self popToViewController:[self findViewController:className] animated:YES];
}

- (id)findViewController:(NSString*)className{
    for (UIViewController *viewController in self.viewControllers) {
        if ([viewController isKindOfClass:NSClassFromString(className)]) {
            return viewController;
        }
    }
    return nil;
}
@end
